package day05;

import java.util.Random;
import java.util.Scanner;

public class Demo01for循环 {
    public static void main(String[] args) {
        Random r = new Random();
        Scanner sc = new Scanner(System.in);

        int score = 0;
        for (int i = 0; i < 10; i++) {
            //1)出题  2)答题   3)运算
            int i1 = r.nextInt(100) + 1;
            int i2 = r.nextInt(100) + 1;
            System.out.println(i1+"+"+i2+"=");
            System.out.println("请输入你的答案");
            int answer = sc.nextInt();
            if (answer==i1+i2){
                score+=10;
                System.out.println("回答正确");
            }else{
                System.out.println("回答错误");
            }
        }
        System.out.println("这次的成绩为" + score);
    }
}
